import org.apache.commons.io.FileUtils;
import org.yray.sip.utils.CMG711;
import org.yray.sip.wav.WavFile;

import java.io.File;
import java.io.IOException;

public class G711Convert {

    public static void main(String[] args) throws IOException {
        String wavFileName="D:\\test\\wav\\10086\\5d41402abc4b2a76b9719d911017c592.wav";
        byte[] bs= FileUtils.readFileToByteArray(new File(wavFileName));
        byte[] wavs = new byte[bs.length - 44];
        System.arraycopy(bs, 44, wavs, 0, wavs.length);
        wavs = CMG711.encode(wavs);
        WavFile wavFile=new WavFile("D:\\test\\wav\\10086\\g711.wav");
        wavFile.write(wavs);
        wavFile.writeFileLen(wavs.length);
        wavFile.close();
    }
}
